<!DOCTYPE html>
<html lang="en">

<head>
    <c:import url="commons.jsp"></c:import>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="description" content="">
    <meta name="author" content="">
    <title>SB Admin</title>
    <!-- Bootstrap core CSS-->
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <!-- Custom fonts for this template-->
    <link href="css/font-awesome.min.css" rel="stylesheet" type="text/css">
    <!-- Page level plugin CSS-->
    <link href="css/dataTables.bootstrap4.css" rel="stylesheet">
    <!-- Custom styles for this template-->
    <link href="css/sb-admin.css" rel="stylesheet">
  <script src="js/jquery.js"></script>
        <script>
            function deleteAlert(id){
                var htm="";
                var tbody=$("tbody");
               $.ajax({
                   url:"deleteClub.action",
                   data:{
                      "id":id
                   },
                   success:function (data){
                       for (var i = 0; i < data.length; i++) {
                           htm+="<tr>+"
                               +"<td><input name='arrays' type='checkbox' value='"+data[i].clId+"' /></td>"
                               +"<td>"+data[i].clId+"</td>"
                               +"<td>"+data[i].clName+"</td>"
                               +"<td>"+data[i].clCourse+"</td>"
                               +"<td>"+data[i].coId+"</td>"
                               +"<td>"+data[i].address+"</td>"
                               +"<td>"+data[i].clTel+"</td>"
                               +"<td>"+data[i].cId+"</td>"
                               +"<td><input class='btn btn-yellow btn-w-md' onclick='deleteAlert("+data[i].clId+")' value='删除' type='button'></td>"
                               +"</tr>"
                       }
                       tbody.html(htm);
                   }
               })
            }
        </script>
<script>
        //全选
        function selectUserAll(obj) {
            console.log(obj);
            if (obj.checked == true) {
                //打开全选，下面的所有选择框都祖选择
                $("[name='arrays']").prop("checked",true);
            } else {
                //关闭全选
                $("[name='arrays']").prop("checked",false);
            }
        }
    </script>

</head>

<body class="fixed-nav sticky-footer bg-dark" id="page-top">
<c:import url="adminNav.jsp"></c:import>
<div class="content-wrapper">
    <div class="container-fluid">
        <!-- 俱乐部信息-->
        <div class="card mb-3">
            <div class="card-header">
                <i class="fa fa-table"></i> 俱乐部信息</div>
            <div class="card-body">
                <div class="table-responsive">
                  <form action="adminClubDelete.action" method="post" >
                    <table class="table table-bordered" id="dataTable" width="100%" cellspacing="0">
                        <thead>
                        <tr>
                            <th><input type="checkbox" onclick="selectUserAll(this)"></th>
                            <th>俱乐部编号</th>
                            <th>俱乐部名称</th>
                            <th>俱乐部课程</th>
                            <th>教练编号</th>
                            <th>俱乐部地址</th>
                            <th>俱乐部电话</th>
                            <th>课程id</th>
                            <th>操作</th>

                        </tr>
                        </thead>

                        <tbody id="tbody">
                        <c:forEach var="clublist" items="${clublist}">
                            <tr>
                                <td><input name="arrays" type="checkbox" value="${clublist.clId}"/></td>
                                <td>${clublist.clId}</td>
                                <td>${clublist.clName}</td>
                                <td>${clublist.clCourse}</td>
                                <td>${clublist.coId}</td>
                                <td>${clublist.address}</td>
                                <td>${clublist.clTel}</td>
                                <td>${clublist.cId}</td>
                                <td> <input class="btn btn-yellow btn-w-md" onclick="deleteAlert(${clublist.clId})"
                                            value="删除" type="button" /></td>
                            </tr>
                        </c:forEach>
                        </tbody>

                    </table>

                    <div style="text-align: center">
                        <input onclick="javascript:location.href='toadminUserAdd.action'" value="添加" type="button" class="btn btn-yellow btn-w-md"/>
                            <input class="btn btn-yellow btn-w-md" value="删除" type="submit" onclick="deleteAlert()"  id="btn"/>
                    </div>
                  </form>
                </div>
                </div>
            </div>
        </div>
    </div>


    <!-- Bootstrap core JavaScript-->
<%--    <script src="statics/vendor/jquery/jquery.min.js"></script>--%>
    <script src="${pd}/statics/vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
    <!-- Core plugin JavaScript-->
    <script src="${pd}/statics/vendor/jquery-easing/jquery.easing.min.js"></script>
    <!-- Page level plugin JavaScript-->
<%--    <script src="statics/vendor/datatables/jquery.dataTables.js"></script>--%>
    <script src="${pd}/statics/vendor/datatables/dataTables.bootstrap4.js"></script>
    <!-- Custom scripts for all pages-->
    <script src="${pd}/statics/js/sb-admin.min.js"></script>
    <!-- Custom scripts for this page-->
    <script src="${pd}/statics/js/sb-admin-datatables.min.js"></script>
</div>
</body>

</html>